package gluck.sintactico.tree;

import java.io.FileWriter;
import java.io.IOException;

public class Tree extends Node{

	public Tree(String name) {
		super(name);
	}
	
	public void printTreeInFile(String fileName){
		FileWriter file;
		
		try{
			file= new FileWriter(fileName);
			file.write("/*\n");
			file.write("*******************************************\n");
			file.write("*******************************************\n");
			file.write("	Syntax Tree					*\n");
			file.write("	Authors:					*\n");
			file.write("			Sebastian Rezzano		*\n");
			file.write("			Bergez Pablo		*\n");
			file.write("*******************************************\n");
			file.write("*******************************************\n");
			file.write("*/\n\n");
			
			file.write("digraph {\n");
			printNodesInFile(file);
			file.write("}\n");
			file.close();
		}catch (IOException e) {
			e.printStackTrace();
		}		
	}
	
	
	private int printNodesInFile(FileWriter file) throws IOException {	
		return super.printNodesInFile(file, 0);
	}
}
